home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
WDFTST__
/
MAKE_WIN.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-06-10
|
2KB
|
59 lines
#include <MacProto.h>
#include <stdio.h>
#include "proto.h"
#include "defines.h"
#include "external_globals.h"
#include "error_message.h"
/* ------------------------ Make_windows --------------------------- */
/* Uses globals: g_app_pathnum, g_checked_handle */
void Make_windows()
{
Rect first_bounds, second_bounds;
Handle the_handle;
int proc_id;
int checked_WDEF_id;
ResType res_type;
Str255 res_name;
UseResFile( g_app_pathnum );
the_handle = GetResource( 'Rect', FIRST_RECT_ID );
first_bounds = *(Rect *)*the_handle;
the_handle = GetResource( 'Rect', SECOND_RECT_ID );
second_bounds = *(Rect *)*the_handle;
g_first_pict = (PicHandle)GetResource( 'PICT', FIRST_PICT_ID );
g_second_pict = (PicHandle)GetResource( 'PICT', SECOND_PICT_ID );
UseResFile( HomeResFile(g_checked_handle) );
if (ResError() != noErr) Warning( ResError() );
GetResInfo( g_checked_handle, &checked_WDEF_id, &res_type, res_name );
proc_id = (checked_WDEF_id << 4) | g_variation_code;
g_first_window = NewWindow( nil, &first_bounds,
(char *)g_first_window_title, FALSE,
proc_id, (WindowPtr)MOVE_TO_FRONT, g_go_away, nil );
SetPort( g_first_window );
InvalRect( &g_first_window->portRect );
ShowWindow( g_first_window );
g_second_window = NewWindow( nil, &second_bounds,
(char *)g_second_window_title, FALSE,
proc_id, (WindowPtr)MOVE_TO_FRONT, g_go_away, nil );
SetPort( g_second_window );
InvalRect( &g_second_window->portRect );
ShowWindow( g_second_window );
UseResFile( g_app_pathnum );
}
/* ------------------- Destroy_windows ----------------------- */
void Destroy_windows()
{
DisposeWindow( g_first_window );
DisposeWindow( g_second_window );
}